﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Business.Operations;
using Entity.Framework;
using System.Data.Entity;

namespace HPDMAS.UserControls
{
    public partial class MusabakaListesi : System.Web.UI.UserControl
    {
        public int sehirId;
        public int sezonId;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }

            GridView1.DataSource = MusabakaOperation.MusabakaGetAllGetBySehirId(sehirId);
            GridView1.DataBind();
        }

        
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string musabakaId = GridView1.SelectedRow.Cells[1].Text;

            Response.Redirect("MusabakaDetay.aspx?musabakaId=" + musabakaId);
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[6].Text = DateTime.Parse(e.Row.Cells[6].Text).ToString("dd/MM/yyyy");
                e.Row.Cells[7].Text = DateTime.Parse(e.Row.Cells[7].Text).ToString("dddd");
                e.Row.Cells[8].Text = DateTime.Parse(e.Row.Cells[8].Text).ToString("hh:mm");
            }
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            GridView1.DataBind();
        }
         
    }
}